home *** CD-ROM | disk | FTP | other *** search
- Path: pegasus.odyssee.net!news
- From: imaze@odyssee.net (Marc Mazerolle)
- Newsgroups: comp.lang.c++
- Subject: Re: Help with Code
- Date: Sun, 25 Feb 1996 05:50:53 GMT
- Organization: Odyssee Internet
- Message-ID: <4gosil$nht@pegasus.odyssee.net>
- References: <4gi3l1$kou@news.voicenet.com> <312C746B.50DA@azstarnet.com>
- Reply-To: imaze@odyssee.net
- NNTP-Posting-Host: pool21_10.odyssee.net
- X-Newsreader: Forte Free Agent v0.55
-
- "S. Brenner" <brenner@azstarnet.com> wrote:
-
- >This code is from "Tech yourself C++ programming in 21
- >Days"
- > But I cannot get it to compile. I am using Code warrrior gold
- >and ansi C++.
-
- >This is the error message I keep getting:
-
- >Error : ambiguous access to overloaded function
- >3.7.c line 9 cin >> DayOff;
-
-
- >And this is the Code:
-
- >#include <iostream>
- >void main()
- >{
- > enum Days { Sunday, Monday, Tuesday, Wednesday,
- >Thursday, Friday, Saturday };
- >
- > Days DayOff;
- >
- > cout << "What day would you like off (0-6)? ";
- > cin >> DayOff;
- >
- > if (DayOff == Sunday || DayOff == Saturday)
- > cout << "\nYou're already off on weekends!\n";
- > else
- > cout << "\nOkay, I'll put in the vacation day.\n";
- >}
-
- Your books assumes that your compiler will generate an integer
- variable for your enum (most compiler do). So cin on an integer should
- work fine...
-
- Your ANSI switch might be causing the problem.
-
-